using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using WEB.BLL.Entities;
using WEB.Exceptions;
namespace WEB.BLL.Services
{
	#region ProjectService

	/// <summary>
	/// DesktopService object for Ibatis mapped table 'Desktop'.
	/// </summary>
	public class ProjectService : IProjectService
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(ProjectService).Name);
	  	private static volatile ProjectService _ProjectService = null;
        public static ProjectService GetInstance()
        {
            if (_ProjectService == null)
            {
                lock (typeof( ProjectService))
                {
                    if (_ProjectService == null) // double-check
                        _ProjectService = new ProjectService();
                }
            }
            return _ProjectService;
        }
		public ProjectService()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public IList<ProjectEntity> Find(ProjectEntity obj)
        {
            try
            {
                IList<ProjectEntity> resul = ExecuteQueryForList<ProjectEntity>("ProjectSearch", obj);
                return resul;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public IList<ProjectEntity> SearchHaveStudent(ProjectEntity obj)
        {
            try
            {
                IList<ProjectEntity> resul = ExecuteQueryForList<ProjectEntity>("ProjectSearchHaveStudent", obj);
                return resul;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public IList<ProjectEntity> LoadNoStudent(ProjectEntity obj)
        {
            try
            {
                IList<ProjectEntity> resul = ExecuteQueryForList<ProjectEntity>("ProjectNoStudent", obj);
                return resul;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public ProjectEntity LoadPrimaryKeyEX(ProjectEntity objE)
        {
            try
            {
                return ExecuteQueryForObject<ProjectEntity>("ProjectLoadPrimaryKeyEX", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public ProjectEntity UpdateStudentAuto()
        {
            try
            {
                return ExecuteQueryForObject<ProjectEntity>("ProjectUpdateStudentAuto", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
    }
    #endregion
}
